<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>我要咨询</title>
    <script src="../../../js/header.js"></script>
    <style>
        html,body,body>div{
            overflow: hidden;
        }
        #unitEntrance{
            margin: 0;
            padding: 0;
        }
        .tab-title{
            font-size: 16px;
            font-weight: bold;
            border-left: 4px solid #0D9AFF;
            font-family: PingFangSC-Medium;
            padding-left:10px;
            margin-bottom: 20px;
        }
        .el-input__inner {
            -webkit-appearance: none;
            background-color: #FFF;
            background-image: none;
            border-radius: 4px;
            border: 1px solid #DCDFE6;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            color: #606266;
            display: inline-block;
            font-size: inherit;
            height: 30px;
            line-height: 30px;
            outline: 0;
            padding: 0 15px;
            -webkit-transition: border-color .2s cubic-bezier(.645,.045,.355,1);
            transition: border-color .2s cubic-bezier(.645,.045,.355,1);
        }
    </style>
</head>
<body>
<div id="firstpage" style="min-height: 600px;overflow: hidden;">
    <el-row type="flex" justify="center" style="margin-top: 25px;">
        <el-col :span="15">
            <el-row :gutter="20">
                <el-col >
                    <el-breadcrumb separator-class="el-icon-arrow-right" style="margin-top: 20px;">
                        <el-breadcrumb-item :to="{ path: '/' }"  @click.native="gobackmain()">首页</el-breadcrumb-item>
                        <el-breadcrumb-item :to="{ path: '/' }"  @click.native="gobackzixun">监管事项清单</el-breadcrumb-item>
                    </el-breadcrumb>
                    <div class="search-tab">
                        <el-tabs v-model="Title" >
                            <el-form :model="selectForm" :rules="rules" ref="selectForm" label-width="150px" style="margin-top: 20px;">
                                <el-row>
                                    <el-col :span="7">
                                        <el-form-item label="监管事项编号:" prop="" label-width="110px">
                                            <el-input v-model="selectForm.supervisionNumber" placeholder=""></el-input>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="7">
                                        <el-form-item label="监管事项名称:" prop="" label-width="110px">
                                            <el-input v-model="selectForm.supervisionName" placeholder=""></el-input>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="8">
                                        <el-form-item label="对应的许可事项类型:" prop="" label-width="150px">
                                            <el-select v-model="selectForm.permitType" >
                                                <el-option label="第一类" value="第一类"></el-option>
                                                <el-option label="第二类" value="第二类"></el-option>
                                                <el-option label="第三类" value="第三类"></el-option>
                                                <el-option label="第四类" value="第四类"></el-option>
                                            </el-select>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="7">
                                        <el-form-item label="监管对象:" prop="" label-width="110px">
                                            <el-input v-model="selectForm.supervisionObject" placeholder=""></el-input>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="7">
                                        <el-form-item label="监管形式:" prop="" label-width="110px">
                                            <el-select v-model="selectForm.supervisionForm" >
                                                <el-option
                                                        v-for="item in supervisionFormList"
                                                        :key="item.appId"
                                                        :label="item.dictName"
                                                        :value="item.dictName"
                                                ></el-option>
                                            </el-select>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="8">
                                        <el-form-item label="处置状态:" prop="" label-width="150px">
                                            <el-select v-model="selectForm.status" >
                                                <el-option label="待公开" value="0"></el-option>
                                                <el-option label="已公开" value="1"></el-option>
                                                <el-option label="已撤回" value="2"></el-option>
                                            </el-select>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <div style="float: right;">
                                        <el-button type="success" size="small" style="width: 60px;height: 30px;" @click="newForm()">新建</el-button>
                                        <el-button type="primary" size="small" style="width: 60px;height: 30px;" @click="searchForm()">查询</el-button>
                                        <el-button type="warning" size="small" style="width: 60px;height: 30px;" @click="resetForm()">重置</el-button>
                                    </div>
                                </el-row>
                            </el-form>
                            <el-table :data="tableData"  max-height="620"  border style="width: 100%; margin-top: 10px;" :header-cell-style="{background:'#eef1f6',color:'#606266'}">
                                <el-table-column type="selection" ></el-table-column>
                                <el-table-column
                                        type="index"
                                        label="序号"
                                        width="50"
                                        align="center">
                                </el-table-column>
                                <el-table-column
                                        prop="supervisionNumber"
                                        label="监管事项编号"
                                        width="110"
                                        align="center" >
                                </el-table-column>
                                <el-table-column
                                        prop="supervisionName"
                                        :show-overflow-tooltip="true"
                                        label="监管事项名称"
                                        width="110"
                                        align="center">
                                </el-table-column>
                                <el-table-column
                                        prop="permitType"
                                        label="对应的许可事项类型"
                                        width="110"
                                        align="center">
                                    <!--<template slot-scope="scope">-->
                                        <!--<span v-if="scope.row.permitType=='第一类'">第一类</span>-->
                                        <!--<span v-if="scope.row.permitType=='第二类'">第二类</span>-->
                                        <!--<span v-if="scope.row.permitType=='第三类'">第三类</span>-->
                                        <!--<span v-if="scope.row.permitType=='第四类'">第四类</span>-->
                                    <!--</template>-->
                                </el-table-column>
                                <el-table-column
                                        prop="supervisionSubItem"
                                        label="监管事项子项"
                                        :show-overflow-tooltip="true"
                                        width="110"
                                        align="center">
                                </el-table-column>
                                <el-table-column
                                        prop="supervisionObject"
                                        label="监管对象"
                                        :show-overflow-tooltip="true"
                                        width="110"
                                        align="center">
                                </el-table-column>
                                <el-table-column
                                        prop="supervisionForm"
                                        label="监管形式"
                                        :show-overflow-tooltip="true"
                                        width="90"
                                        align="center">
                                    <!--<template slot-scope="scope">
                                        <span v-if="scope.row.supervisionForm==0">专项检查</span>
                                        <span v-if="scope.row.supervisionForm==1">突击检查</span>
                                        <span v-if="scope.row.supervisionForm==2">线上检查</span>
                                    </template>-->
                                </el-table-column>
                                <el-table-column
                                        prop="supervisionWay"
                                        label="监管方式"
                                        width="90"
                                        align="center">
                                    <!--<template slot-scope="scope">
                                        <span v-if="scope.row.supervisionWay==0">审查</span>
                                        <span v-if="scope.row.supervisionWay==1">调查</span>
                                    </template>-->
                                </el-table-column>
                                <el-table-column
                                        prop="supervisionResult"
                                        label="监管结果"
                                        :show-overflow-tooltip="true"
                                        width="110"
                                        align="center">
                                </el-table-column>
                                <el-table-column
                                        prop="supervisionRank"
                                        label="监管层级"
                                        width="110"
                                        align="center">
                                </el-table-column>
                                <el-table-column
                                        prop="publicLocation"
                                        label="公开位置"
                                        width="90"
                                        align="center">
                                    <!--<template slot-scope="scope">
                                        <span v-if="scope.row.publicLocation=='工作门户'">工作门户</span>
                                        <span v-if="scope.row.publicLocation=='服务门户'">服务门户</span>
                                        <span v-if="scope.row.publicLocation=='工作和服务门户'">工作&服务门户</span>
                                    </template>-->
                                </el-table-column>
                                <el-table-column
                                        prop="status"
                                        label="处置状态"
                                        width="100"
                                        align="center">
                                    <template slot-scope="scope">
                                        <span v-if="scope.row.status==0">待公开</span>
                                        <span v-if="scope.row.status==1">已公开</span>
                                        <span v-if="scope.row.status==2">已撤回</span>
                                    </template>
                                </el-table-column>
                                <el-table-column label="操作" align="center" width="">
                                    <template slot-scope="scope" fixed="right">
                                        <sapn v-if="scope.row.status==0">
                                            <el-button class="look" size="mini" @click="checkContent(scope.$index,scope.row)">查看</el-button>
                                            <el-button type="primary" size="mini" @click="edit(scope.$index,scope.row)">修改</el-button>
                                            <el-button type="danger" size="mini" @click="del(scope.$index,scope.row)">删除</el-button>
                                            <el-button type="success" size="mini" @click="effect(scope.$index,scope.row)" >发布</el-button>
                                            <el-button type="warning" size="mini" @click="revoke(scope.$index,scope.row)" disabled>撤回</el-button>
                                        </sapn>
                                        <sapn v-if="scope.row.status==1">
                                            <el-button class="look" size="mini" @click="checkContent(scope.$index,scope.row)">查看</el-button>
                                            <el-button type="primary" size="mini" @click="edit(scope.$index,scope.row)" disabled>修改</el-button>
                                            <el-button type="danger" size="mini" @click="del(scope.$index,scope.row)" disabled>删除</el-button>
                                            <el-button type="success" size="mini" @click="effect(scope.$index,scope.row)" disabled>发布</el-button>
                                            <el-button type="warning" size="mini" @click="revoke(scope.$index,scope.row)" >撤回</el-button>
                                        </sapn>
                                        <sapn v-if="scope.row.status==2">
                                            <el-button class="look" size="mini" @click="checkContent(scope.$index,scope.row)">查看</el-button>
                                            <el-button type="primary" size="mini" @click="edit(scope.$index,scope.row)">修改</el-button>
                                            <el-button type="danger" size="mini" @click="del(scope.$index,scope.row)">删除</el-button>
                                            <el-button type="success" size="mini" @click="effect(scope.$index,scope.row)">发布</el-button>
                                            <el-button type="warning" size="mini" @click="revoke(scope.$index,scope.row)" disabled>撤回</el-button>
                                        </sapn>
                                    </template>
                                </el-table-column>
                            </el-table>
                            <div style="overflow: hidden;" justify="center">
                                <div class="pagination">
                                    <el-pagination
                                            @size-change="handleSizeChange"
                                            @current-change="handleCurrentChange"
                                            :current-page="currentPage"
                                            :page-sizes="[10, 20, 30, 40]"
                                            :page-size="pagesize"
                                            background
                                            layout="total, sizes,prev, pager, next"
                                            :total="tableTotal"
                                            prev-text="上一页"
                                            next-text="下一页">
                                    </el-pagination>
                                </div>
                            </div>
                            <el-dialog title="" :visible.sync="dialogForm" center fullscreen >
                                <el-row type="flex" justify="center" style="margin-top: 15px;">
                                    <el-col :span="15">
                                        <el-form :model="Detail" :rules="rules" ref="Detail" >
                                            <el-row>
                                                <el-col :span="8" class="tab-title">
                                                    监管事项清单详情
                                                </el-col>
                                            </el-row>
                                            <el-row>
                                                <el-col>
                                                    <el-form-item label="监管事项编号:"  prop="supervisionNumber" label-width="140px" :rules="rules.supervisionNumber" >
                                                        <el-input v-model="Detail.supervisionNumber"  placeholder="" :disabled="formDisabled"></el-input>
                                                    </el-form-item>
                                                </el-col>
                                            </el-row>
                                            <el-row>
                                                <el-col >
                                                    <el-form-item label="监管事项名称:" prop="supervisionName" label-width="140px"  :rules="rules.supervisionName">
                                                        <el-input v-model="Detail.supervisionName"  placeholder="" :disabled="formDisabled"></el-input>
                                                    </el-form-item>
                                                </el-col>
                                            </el-row>
                                            <el-row  >
                                                <el-col :span="12">
                                                    <el-form-item label="对应许可事项名称:" prop="permitName" label-width="140px"  :rules="rules.permitName">
                                                        <el-input v-model="Detail.permitName"  placeholder="" :disabled="formDisabled"></el-input>
                                                    </el-form-item>
                                                </el-col>
                                                <el-col :span="12">
                                                    <el-form-item label="对应许可事项类型:" prop="permitType"  label-width="140px" :rules="rules.permitType">
                                                        <el-select v-model="Detail.permitType" :disabled="formDisabled" style="width: 100%;">
                                                            <el-option
                                                                    v-for="item in permitTypeList"
                                                                    :key="item.appId"
                                                                    :label="item.dictName"
                                                                    :value="item.dictName"
                                                            ></el-option>
                                                        </el-select>
                                                    </el-form-item>
                                                </el-col>
                                            </el-row>
                                            <el-row>
                                                <el-col >
                                                    <el-form-item label="监管事项子项:" prop="supervisionSubItem" label-width="140px" :rules="rules.supervisionSubItem" >
                                                        <el-input v-model="Detail.supervisionSubItem"  placeholder="" :disabled="formDisabled"></el-input>
                                                    </el-form-item>
                                                </el-col>
                                            </el-row>
                                            <el-row>
                                                <el-col >
                                                    <el-form-item label="监管对象:" prop="supervisionObject" label-width="140px"  :rules="rules.supervisionObject" >
                                                        <el-input v-model="Detail.supervisionObject"  placeholder="" :disabled="formDisabled"></el-input>
                                                    </el-form-item>
                                                </el-col>
                                            </el-row>
                                            <el-row>
                                                <el-col>
                                                    <el-form-item label="监管部门:" prop="supervisionDept" label-width="140px" >
                                                        <el-input v-model="Detail.supervisionDept"  placeholder="" :disabled="formDisabled"></el-input>
                                                    </el-form-item>
                                                </el-col>
                                            </el-row>
                                            <el-row>
                                                <el-col :span="12">
                                                    <el-form-item label="监管形式:" prop="supervisionForm" label-width="140px"  :rules="rules.supervisionForm">
                                                        <el-select v-model="Detail.supervisionForm ":disabled="formDisabled" style="width: 100%;"  >
                                                            <el-option
                                                                    v-for="item in supervisionFormList"
                                                                    :key="item.appId"
                                                                    :label="item.dictName"
                                                                    :value="item.dictName"
                                                            ></el-option>
                                                        </el-select>
                                                    </el-form-item>
                                                </el-col>
                                                <el-col :span="12">
                                                    <el-form-item label="监管方式:" prop="supervisionWay" label-width="140px" :rules="rules.supervisionWay">
                                                        <el-select v-model="Detail.supervisionWay" :disabled="formDisabled" style="width: 100%;">
                                                            <el-option
                                                                    v-for="item in supervisionWayList"
                                                                    :key="item.appId"
                                                                    :label="item.dictName"
                                                                    :value="item.dictName"
                                                            ></el-option>
                                                        </el-select>
                                                    </el-form-item>
                                                </el-col>
                                            </el-row>
                                            <el-row>
                                                <el-col >
                                                    <el-form-item label="监管流程:"  prop="supervisionProcess" label-width="140px"  :rules="rules.supervisionProcess">
                                                        <el-input
                                                                type="textarea"
                                                                :disabled="formDisabled"
                                                                :autosize="{ minRows: 8, maxRows: 8}"
                                                                placeholder=""
                                                                maxlength="500"
                                                                show-word-limit
                                                                v-model="Detail.supervisionProcess">
                                                        </el-input>
                                                    </el-form-item>
                                                </el-col>
                                            </el-row>
                                            <el-row>
                                                <el-col>
                                                    <el-form-item label="监管结果:" prop="supervisionResult" label-width="140px" :rules="rules.supervisionResult">
                                                        <el-input
                                                                type="textarea"
                                                                :disabled="formDisabled"
                                                                :autosize="{ minRows: 8, maxRows: 8}"
                                                                placeholder=""
                                                                maxlength="500"
                                                                show-word-limit
                                                                v-model="Detail.supervisionResult">
                                                        </el-input>
                                                    </el-form-item>
                                                </el-col>
                                            </el-row>
                                            <el-row>
                                                <el-col >
                                                    <el-form-item label="监管层级:" prop="supervisionRank" label-width="140px":rules="rules.supervisionRank">
                                                        <el-select v-model="Detail.supervisionRank" multiple   :disabled="formDisabled" style="width: 100%;">
                                                            <el-option
                                                                    v-for="item in supervisionRankList"
                                                                    :key="item.appId"
                                                                    :label="item.dictName"
                                                                    :value="item.dictName"
                                                            ></el-option>
                                                        </el-select>
                                                    </el-form-item>
                                                </el-col>
                                            </el-row>
                                            <el-row>
                                                <el-col >
                                                    <el-form-item label="设定的依据:"  prop="settingBasis" label-width="140px"  :rules="rules.settingBasis">
                                                        <el-input
                                                                type="textarea"
                                                                :disabled="formDisabled"
                                                                :autosize="{ minRows: 8, maxRows: 8}"
                                                                placeholder=""
                                                                maxlength="500"
                                                                show-word-limit
                                                                v-model="Detail.settingBasis">
                                                        </el-input>
                                                    </el-form-item>
                                                </el-col>
                                            </el-row>
                                            <el-row>
                                                <el-col :span="24">
                                                    <el-form-item label="对应业务系统链接:" prop="Detail.linkUrl" label-width="140px" >
                                                        <el-link :href="Detail.linkUrl" target="_blank">
                                                            <span style="color:#409EFF">{{this.Detail.linkUrl}}</span>
                                                        </el-link>
                                                    </el-form-item>
                                                </el-col>
                                            </el-row>
                                            <el-row>
                                                <el-col >
                                                    <div style="float:right;">
                                                        <span  v-if="showOnSubmit == false">
                                                            <el-button type="primary" size="small" style="width: 60px;height: 30px;" @click="save('Detail')">暂存</el-button>
                                                            <el-button type="success" size="small" style="width: 60px;height: 30px;" @click="fabu('Detail')">保存</el-button>
                                                        </span>
                                                        <sapn v-if="showbutton==true">
                                                            <el-button type="success" size="small" style="width: 60px;height: 30px;" @click="xiugai('Detail')">修改</el-button>
                                                        </sapn>
                                                        <el-button type="info" size="small" style="width: 60px;height: 30px;" @click="dialogForm = false; clearDetail()">关闭</el-button>
                                                    </div>
                                                </el-col>
                                            </el-row>
                                        </el-form>
                                    </el-col>
                                </el-row>
                            </el-dialog>
                            </el-tab-pane>
                        </el-tabs>
                    </div>
                </el-col>
            </el-row>
        </el-col>
    </el-row>
</div>
</body>
<script>
    var firstpage = new Vue({
        el: '#firstpage',
        data() {
            return {
                //
                permitTypeList:[{
                    appId : '0',
                    dictName : '第一类'
                },{
                    appId : '1',
                    dictName : '第二类'
                },{
                    appId : '2',
                    dictName : '第三类'
                },{
                    appId : '3',
                    dictName : '第四类'
                }],
                supervisionFormList:[],
                supervisionWayList:[],
                supervisionRankList:[{
                    appId : '0',
                    dictName : '国家级'
                },{
                    appId : '1',
                    dictName : '省级'
                },{
                    appId : '2',
                    dictName : '市级'
                },{
                    appId : '3',
                    dictName : '县级'
                }],
                dialogForm: false,
                currentPage: 1, //默认显示页面为1
                pagesize: 10, // 每页的数据条数
                tableTotal:'',
                Detail: {
                    id:'',
                    supervisionNumber:'',
                    supervisionName:'',
                    permitName:'',
                    permitType:'',
                    supervisionSubItem:'',
                    supervisionObject:'',
                    supervisionForm:'',
                    supervisionWay:'',
                    supervisionProcess:'',
                    supervisionResult:'',
                    supervisionRank:'',
                    settingBasis:'',
                    supervisionDept:'',
                    linkUrl:''

                },
                rules: {
                    supervisionNumber: [{
                        required : true,
                        message : '请输入监管事项编号',
                        trigger : 'blur'
                    }],
                    supervisionName: [{
                        required : true,
                        message : '请输入监管事项名称',
                        trigger : 'blur'
                    }],
                    permitName:[{
                        required : true,
                        message : '请输入对应的许可事项名称',
                        trigger : 'blur'
                    }],
                    permitType:[{
                        required : true,
                        message : '请选择对应的许可事项类型',
                        trigger : 'blur'
                    }],
                    supervisionSubItem: [{
                        required : true,
                        message : '请输入监管事项子项',
                        trigger : 'blur'
                    }],
                    supervisionObject: [{
                        required : true,
                        message : '请输入监管对象',
                        trigger : 'blur'
                    }],
                    supervisionForm:[{
                        required : true,
                        message : '请选择监管形式',
                        trigger : 'blur'
                    }],
                    supervisionWay:[{
                        required : true,
                        message : '请选择监管方式',
                        trigger : 'blur'
                    }],
                    supervisionProcess: [{
                        required : true,
                        message : '请输入监管流程',
                        trigger : 'blur'
                    }],
                    supervisionResult: [{
                        required : true,
                        message : '请输入监管结果',
                        trigger : 'blur'
                    }],
                    supervisionRank:[{
                        required : true,
                        message : '请输入监管层级',
                        trigger : 'blur'
                    }],
                    settingBasis:[{
                        required : true,
                        message : '请输入设定的依据',
                        trigger : 'blur'
                    }]
                },
                selectForm: {
                    supervisionNumber:'',
                    supervisionName : '',
                    supervisionObject : '',
                    permitType:'',
                    supervisionForm : '',
                    status:''
                },
                Form: {
                    supervisionNumber:'',
                    supervisionName : '',
                    supervisionObject : '',
                    permitType:'',
                    supervisionForm : '',
                    status:''
                },
                formDisabled: false,
                showbutton:false,
                flag:'',
                currentRow: null,
                tableData: [],
                showOnSubmit: true,
                showOnReplace: false
            }
        },
      created(){
            debugger;
            /!* 监管形式 *!/
            axios.post('/dzjportal/dict/getdict/d_supervisionFormList').then(res => {
                    this.supervisionFormList = res.data.data.result;
            }).catch(e => {
                this.$message.error("网络连接超时");
            });
            /!* 监管方式 *!/
            axios.post('/dzjportal/dict/getdict/d_supervisionWayList').then(res => {
                this.supervisionWayList = res.data.data.result;
                 console.log(this.orgList)
            }).catch(e => {
                this.$message.error("网络连接超时");
            });
         },
        mounted(){
            this.getData();
        },
        methods: {
            getData() {
                axios({
                    method: 'get',
                    url: '/dzjportal/supervision/listPage',
                    params: {
                        pageSize: this.pagesize,
                        pageNo: this.currentPage,
                        supervisionNumber :this.Form.supervisionNumber.trim(),
                        supervisionName : this.Form.supervisionName.trim(),
                        supervisionObject : this.Form.supervisionObject.trim(),
                        permitType:this.Form.permitType,
                        supervisionForm : this.Form.supervisionForm,
                        status:this.Form.status
                    }
                })
                    .then(response => {
                    let data = response.data;
                if (data.code == 200) {
                    console.log(data.data.results)
                    let dataInformation = data.data.results;
                    this.tableTotal = data.data.total;// 数据长度
                    this.tableData = dataInformation;
                } else {
                    this.$message.error(data.msg);
                }
            })
            .catch(function (error) {
                    console.log(error);
                });
            },
            /* 列表页搜索 */
            searchForm() {
                this.currentPage=1;
                this.Form=  JSON.parse(JSON.stringify(this.selectForm));
                axios({
                    method: 'get',
                    url: '/dzjportal/supervision/listPage',
                    params: {
                        pageSize: this.pagesize,
                        pageNo: this.currentPage,
                        supervisionNumber :this.Form.supervisionNumber.trim(),
                        supervisionName : this.Form.supervisionName.trim(),
                        supervisionObject : this.Form.supervisionObject.trim(),
                        permitType:this.Form.permitType,
                        supervisionForm : this.Form.supervisionForm,
                        status:this.Form.status
                    }
                })
                    .then(response => {
                    let data = response.data;
                if (data.code == 200) {
                    let dataInformation = data.data.results;
                    this.tableTotal = data.data.total;// 数据长度
                    this.tableData = dataInformation;
                } else {
                    this.$message.error(data.msg);
                }
            })
            .catch(function (error) {
                    console.log(error);
                });
            },
            newForm(){
                this.dialogForm = true;
                this.showbutton=false;
                this.checkDisabled(false);
                this.showOnSubmit=false;
            },
            // 查看
            checkContent(index,row){
                this.showOnSubmit = true;
                this.showbutton=false;
                this.dialogForm = true;
                this.showInformation(index,row);
                this.checkDisabled(true);
            },
            // 修改
            edit(index,row){
                this.showOnSubmit = true;
                this.showbutton = true;
                this.dialogForm = true
                this.showInformation(index,row);
                this.checkDisabled(false);

            },
            // 删除
            del(index, row) {
                console.log(row.id);
                var pagesize = this.pagesize;
                var pageno = this.currentPage;
                var afterPage =  Math.floor( this.tableTotal / pagesize);
                var nowSize  = this.tableTotal % pagesize;
                this.$confirm('确定要删除吗?', '提示', {
                    cancelButtonText: '取消',
                    confirmButtonText: '确定',
                    type: 'warning'
                }).then(() => {
                    axios({
                              method: 'get',
                              url: '/dzjportal/supervision/delete',
                              params : {
                                  id : row.id,
            }
            })
            .then(response => {
                    let data = response.data;
                console.log(response);
                if (data.code == 200) {
                    // 确认删除
                    this.$message({
                        type: 'success',
                        message: '删除成功!'
                    });
                    this.resetForm();
                    if(nowSize =='1'){
                        if(afterPage=='0'){
                            this.currentPage = 1;
                        }else if(this.currentPage>afterPage){
                            this.currentPage = afterPage;
                        }
                        this.getData();
                    }else {
                        this.getData();
                    }
                } else {
                    this.$message.error(data.msg);
                }
            })
            .catch(function (error) {
                    console.log(error);
                });
            }).catch(() => {
                    this.$message({
                    type: 'info',
                    message: '取消删除'
                });
            });
            },
            revoke(index, row) {
                this.$confirm('确定要撤销吗?', '提示', {
                    cancelButtonText: '取消',
                    confirmButtonText: '确定',
                    type: 'warning'
                }).then(() => {
                    axios({
                              method: 'post',
                              url: '/dzjportal/supervision/revoke',
                              params : {
                                  id : row.id,
            }
            })
            .then(response => {
                    let data = response.data;
                console.log(response);
                if (data.code == 200) {
                    // 确认撤销
                    this.$message({
                        type: 'success',
                        message: '撤销成功!'
                    });
                    this.resetForm();
                    this.getData();
                } else {
                    this.$message.error(data.msg);
                }
            })
            .catch(function (error) {
                    console.log(error);
                });
            }).catch(() => {
                    this.$message({
                    type: 'info',
                    message: '取消撤销'
                });
            });
            },
            //发布
            effect(index, row) {
                this.$confirm('确定要发布吗?', '提示', {
                    cancelButtonText: '取消',
                    confirmButtonText: '确定',
                    type: 'warning'
                }).then(() => {
                    axios({
                              method: 'post',
                              url: '/dzjportal/supervision/effect',
                              params : {
                                  id : row.id,
            }
            })
            .then(response => {
                    let data = response.data;
                console.log(response);
                if (data.code == 200) {
                    // 确认撤销
                    this.$message({
                        type: 'success',
                        message: '发布成功!'
                    });
                    this.resetForm();
                    this.getData();
                } else {
                    this.$message.error(data.msg);
                }
            })
            .catch(function (error) {
                    console.log(error);
                });
            }).catch(() => {
                    this.$message({
                    type: 'info',
                    message: '取消发布'
                });
            });
            },
            //表单修改
            xiugai(Detail) {
                this.$refs.Detail.validate((valid) => {
                    if (valid) {
                        if(this.Detail.supervisionRank.length>0) {
                            this.flag = this.Detail.supervisionRank.join(",");
                            this.Detail.supervisionRank=this.flag;
                        }
                        axios({
                            method: 'post',
                            url: '/dzjportal/supervision/update',
                            data: this.Detail
                        })
                            .then((response) => {
                            let data = response.data;
                        if (data.code == 200) {
                            this.clearDetail();
                            this.dialogForm = false;
                            this.getData();
                            this.$message({
                                type: 'success',
                                message: '修改成功!'
                            });

                        } else {
                            this.$message.error(data.msg);
                        }
                    })
                    }
                })
            },
            //表单保存
            fabu(Detail) {
                debugger;
                this.$refs.Detail.validate((valid) => {
                    if (valid) {
                        if(this.Detail.supervisionRank.length>0) {
                            this.flag = this.Detail.supervisionRank.join(",");
                            this.Detail.supervisionRank=this.flag;
                        }
                        axios({
                            method: 'post',
                            url: '/dzjportal/supervision/add',
                            data: this.Detail
                        })
                            .then((response) => {
                            let data = response.data;
                        if (data.code == 200) {
                            debugger;
                            this.clearDetail();
                            this.dialogForm = false;
                            this.getData();
                            this.$message({
                                type: 'success',
                                message: '保存成功!'
                            });

                        } else {
                            this.$message.error(data.msg);
                        }
                    })
                    }
                })
            },
            // 表单暂存
            save(Detail) {
                this.$refs.Detail.validate((valid) => {
                    if (valid) {
                        if(this.Detail.supervisionRank.length>0) {
                            this.flag = this.Detail.supervisionRank.join(",");
                            this.Detail.supervisionRank=this.flag;
                        }
                        axios({
                            method: 'post',
                            url: '/dzjportal/supervision/zcadd',
                            data: this.Detail
                        })
                            .then((response) => {
                            let data = response.data;
                        if (data.code == 200) {
                            debugger;
                            this.dialogForm = false;
                            this.clearDetail();
                            this.$message({
                                type: 'success',
                                message: '暂存成功!'
                            });
                            this.resetForm();
                            this.getData();
                        } else {
                            this.$message.error(data.msg);
                        }
                    });
                    }
                })

            },
            gobackmain(){
                parent.mainwork.backIndex();
            },
            clearDetail() {
                this.Detail.Id = '';
                this.Detail.supervisionNumber='';
                this.Detail.supervisionName='';
                this.Detail.permitName='';
                this.Detail.permitType='';
                this.Detail.supervisionSubItem='';
                this.Detail.supervisionObject='';
                this.Detail.supervisionForm='';
                this.Detail.supervisionWay='';
                this.Detail.supervisionProcess='';
                this.Detail.supervisionResult='';
                this.Detail.supervisionRank='';
                this.Detail.settingBasis='';
                this.Detail.isPublic='';
                this.Detail.publicLocation='';
                this.Detail.supervisionDept='';
                this.Detail.linkUrl=''
            },
            changeType(val){
                debugger;
                if(val=='0'){
                    isPublic1=true;
                }
            },
            // 设置允许填写和不允许填写
            checkDisabled(n) {
                if (n) {
                    this.formDisabled = true;
                } else {
                    this.formDisabled = false;
                }
            },
            /* 列表页重置 */
            resetForm() {
                this.currentPage = 1; //默认显示页面为1
                this.selectForm.pagesize = 10; // 每页的数据条数
                this.selectForm.supervisionNumber='',
                this.selectForm.supervisionName='',
                this.selectForm.supervisionObject='',
                this.selectForm.permitType='',
                this.selectForm.supervisionForm='',
                this.selectForm.status='',
                this.Form.supervisionNumber='',
                this.Form.supervisionName='',
                this.Form.supervisionObject='',
                this.Form.permitType='',
                this.Form.supervisionForm='',
                this.Form.status='',
                this.getData();
            },
            /* 单选搜索表单 */
            selectCurrentChange(val){
                this.currentRow = val;
            },
            //每页下拉显示数据
            handleSizeChange(size) {
                this.pagesize = size;
                this.getData();
            },
            //点击第几页
            handleCurrentChange(currentPage) {
                this.currentPage = currentPage;
                this.getData();
            },
            // 公共方法--查看
            showInformation(index,row){
                axios({
                    method: 'get',
                    url: '/dzjportal/supervision/queryById',
                    params:{
                        id: row.id
                    }
                })
                    .then(response => {
                    console.log(response.data);
                if (response.data.code == 200) {
                    debugger;
                    this.Detail = response.data.data;
                    if(this.Detail.supervisionRank.length !=""){
                        this.flag=this.Detail.supervisionRank.split(",");
                        this.Detail.supervisionRank=this.flag;
                    }
                } else {
                    this.$message.error(data.msg);
                }
            }).catch(function (error) {
                    console.log(error);
                });
            }
        }
    })
</script>
</html>